import {requestClient} from '#/api/request';
import type {
  AssetBo, AssetEpcRelationSo, AssetEpcRelationVo,
  AssetPageVo,
  AssetSo,
  LifecycleVo, OutboundPageSo, OutboundPageVo,
  OutboundSubmitBo,
  PageRequest, PageRespons
} from '#/api/common';
// import { AuthApi } from '#/api/core';

export namespace AssetApi {
  /** 登录接口参数 */
  export interface AssetSo {
    keyword: string;
    contractStartTime: string;
    contractEndTime: string;
    uploadStartTime: string;
    uploadEndTime: string;
    clienteleId: string;
  }

  // /** 登录接口返回值 */
  // export interface AssetBo {
  //   assetName: string;
  //   assetCode: string;
  //   assetEpc: string;
  //   clientId: string;
  //   assetImage: string;
  //   remark: string;
  // }

  export interface AssetPageVo {
    id: string;
    assetCode: string;
    assetEpc: string;
    assetName: string;
    assetType: string;
    assetStatus: string;
    assetLocation: string;
    assetFloor: string;
    assetPosition: string;
    limitDate: string;
    remark: string;
    createTime: string;
    updateTime: string;
  }

  export interface PageRequest {
    current: string;
    size: string;
    query: any;
  }
}

/**
 * 合同分页列表
 */
export async function pageAssetApi(
  data: PageRequest<AssetSo>,
) {
  return requestClient.post<AssetPageVo>('/asset/page', data);
}

export async function addAssetApi(data: AssetBo) {
  return requestClient.post<Boolean>('/asset/add', data);
}

export async function lifecycleApi(data: any) {
  console.log('lifecycleApi data', data)
  return requestClient.get<LifecycleVo[]>('/lifecycle/list', {
    params: {...data}
  });
}

export async function outboundSubmitApi(data: OutboundSubmitBo) {
  return requestClient.post<Boolean>('/outbound/submit', data);
}


export async function outboundPageApi(data:PageRequest<OutboundPageSo> ) {
  return requestClient.post<PageRespons<OutboundPageVo>>('/outbound/page', data);
}

export async function assetEpcRelationPageApi(data: PageRequest<AssetEpcRelationSo>) {
  return requestClient.post<PageRespons<AssetEpcRelationVo>>('/relation/page', data);
}

export async function assetEpcRelationDeleteApi(data:any) {
  return requestClient.get<boolean>('/relation/delete', {
    params: {...data}
  });
}
